<?php

/**
 * Vuelo form base class.
 *
 * @method Vuelo getObject() Returns the current form's model object
 *
 * @package    aeropostal
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseVueloForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'numVuelo' => new sfWidgetFormInputHidden(),
      'tipo'     => new sfWidgetFormInputText(),
      'origen'   => new sfWidgetFormPropelChoice(array('model' => 'Estacion', 'add_empty' => false)),
      'destino'  => new sfWidgetFormPropelChoice(array('model' => 'Estacion', 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'numVuelo' => new sfValidatorChoice(array('choices' => array($this->getObject()->getNumvuelo()), 'empty_value' => $this->getObject()->getNumvuelo(), 'required' => false)),
      'tipo'     => new sfValidatorString(array('max_length' => 255)),
      'origen'   => new sfValidatorPropelChoice(array('model' => 'Estacion', 'column' => 'codigo')),
      'destino'  => new sfValidatorPropelChoice(array('model' => 'Estacion', 'column' => 'codigo')),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'Vuelo', 'column' => array('numVuelo')))
    );

    $this->widgetSchema->setNameFormat('vuelo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Vuelo';
  }


}
